using System;
using System.Collections.Generic;
using System.Linq;
namespace BuddhistSchools.DTO.Models
{
    public partial class Province
    {
        public List<Province> GetListProvince()
        {
            dbBuddhistSchoolsContext db = new dbBuddhistSchoolsContext();
            return db.Provinces.OrderBy(p=>p.Name).ToList();
        }
        public bool Them(Province province)
        {
            dbBuddhistSchoolsContext db = new dbBuddhistSchoolsContext();
            var dt = db.Provinces;
            dt.Add(province);
            return db.SaveChanges() > 0;
        }
        public bool Sua(Province province)
        {
            dbBuddhistSchoolsContext db = new dbBuddhistSchoolsContext();
            var pro = db.Provinces.Find(province.Id);
            pro.Name = province.Name;
            return db.SaveChanges() > 0;
        }
    }
}
